/**
 * Created by Administrator on 2016/12/1 0001.
 */
app.controller("account",["$scope",'$location',function($scope,$location){
    $("a").click(function(e){
        e.preventDefault();
    });
    $(".remove").click(function(){
        $(".deleteAccount").show();
    });
    $scope.deleteAccount = function(){
        $(".deleteAccount").hide();
    };
    $scope.cancelDeleteAccount = function(){
        $(".deleteAccount").hide();
    };
    $(".reset").click(function(){
        $(".resetPwd").show();
    });
    $scope.resetPwd = function(){
        $(".resetPwd").hide();
    };
    $scope.cancelResetPwd = function(){
        $(".resetPwd").hide();
    };
    $('input').iCheck({
        checkboxClass: 'icheckbox_minimal-green',
        radioClass: 'iradio_minimal-green',
        increaseArea: '20%' // optional
    });

//    分配权限
    var demo2 = $('.demo1').bootstrapDualListbox({
        nonSelectedListLabel: '未分配角色',
        selectedListLabel: '已选择角色',
        preserveSelectionOnMove: 'moved',
        moveAllLabel:"移动所有",
        removeAllLabel:"移除所有",
        infoText:" ",
        infoTextEmpty:" ",
        filterPlaceHolder:"请输入要搜索的内容",
        moveOnSelect: true
    });
    //分配权限中的树
    //    zTreee
    var setting = {
        check: {
            enable: true,
            chkDisabledInherit: true
        }
    };

    var zNodes =[
        { name:"菜单", open:true,"chkDisabled":true,
            children: [
                { name:"权限管理",
                    children: [
                        { name:"账号管理","checked":true },
                        { name:"用户管理","checked":true },
                        { name:"菜单管理","checked":true },
                        { name:"角色管理","checked":true }
                    ]
                },
                { name:"外观管理",
                    children: [
                        { name:"主题"},
                        { name:"布局"},
                        { name:"皮肤"}
                    ]
                },
                { name:"无人机数据", isParent:true}
            ]},
        { name:"资源","chkDisabled":true,
            children: [
                { name:"图片", open:true,
                    children: [
                        { name:"icon","checked":true },
                        { name:"zTree"},
                        { name:"页面"},
                        { name:"表单"}
                    ]
                },
                { name:"郑州",
                    children: [
                        { name:"区域"},
                        { name:"行政规划"},
                        { name:"小型站"},
                        { name:"国控站"}
                    ]
                },
                { name:"样式",
                    children: [
                        { name:"表单"},
                        { name:"zTree"},
                        { name:"公共"},
                        { name:"组件"}
                    ]
                }
            ]
        }
    ];

    $(document).ready(function(){
        $.fn.zTree.init($("#account-character-allot-zTree"), setting, zNodes);
    });
    $(".moveall").html('<i class="glyphicon glyphicon-chevron-right"></i><i class="glyphicon glyphicon-chevron-right"></i> ');
    $(".removeall").html('<i class="glyphicon glyphicon-chevron-left"></i><i class="glyphicon glyphicon-chevron-left"></i> ');
    // $(".bootstrap-duallistbox-container>div").each(function(){
    //     $(this).append(`
    //         <ul class="pagingDetail pull-left" style="margin-top: 5px;">
    //             <li><a href="#">共<span>10</span>条 每页：<span>10</span>条</a></li>
    //         </ul>
    //         <ul class="pagination pull-right" style="margin-top: 5px;">
    //             <li><a href="#">上一页</a></li>
    //             <li><a href="#">下一页</a></li>
    //         </ul>`
    //     )
    // });
    $(".one-duallistbox-container .btn-group").html("");
    $("[name=duallistbox_demo1_helper1]").change(function(){

        //向树形列表追加节点开始
        // function ZtreeNode(name, pName) {//定义ztree的节点类
        //     this.name = name;
        //     this.pName = pName;
        // }
        // var pName = "菜单";
        // var name = "aa";
        // var childZNode = new ZtreeNode(name,pName); //构造子节点
        // var treeObj = $.fn.zTree.getZTreeObj("account-character-allot-zTree");//获取ztree对象
        // var parentZNode = treeObj.getNodeByParam("name", pName); //获取父节点
        // treeObj.addNodes(parentZNode, childZNode, true);
        //向树形列表追加节点结束
    });



}]);
app.controller("accountTable",["$scope",'$location',function($scope,$location){
    $('#accountTable').bootstrapTable({
        columns: [
            {
            checkbox: true
        },{
            field: 'accountName',
            title: '账户',
            align:"left",
            halign:"center"
        }, {
            field: 'creator',
            title: '创建人',
            align:"left",
            halign:"center"
        }, {
            field: 'createDate',
            title: '创建日期',
            align:"left",
            halign:"center"
        }, {
            field: 'isAudit',
            title: '审核',
            width:50
        }, {
            field: 'isEnable',
            title: '启用',
            width:50
        }, {
            field: 'isAllowPc',
            title: 'PC端登录',
            width:50
        }, {
            field: 'isAllowApp',
            title: '移动端登录',
            width:50
        }
        ],
        data: [
             {
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             },{
                 accountName:'jkq',
                 creator:'sysAdmin',
                 createDate:'2017-01-19',
                 isAudit:'<input type="checkbox">',
                 isEnable:'<input type="checkbox">',
                 isAllowPc:'<input type="checkbox">',
                 isAllowApp:'<input type="checkbox">'
             }
            ],
        pagination :true,
        paginationLoop: false,
        striped :true,
        paginationPreText : "上一页",
        paginationNextText :"下一页",
        undefinedText : "暂无数据",
        showColumns :true,
        showExport : true,
        showRefresh :true,
        height:711,
        toolbar:".one-btn-crud",
        showPaginationSwitch:true,
        pageSize:15,
        pageList :[10,15,20]
    });

    $('#accountCharacterTable').bootstrapTable({
        columns: [
            {
                checkbox: true
            },{
                field: 'roleName',
                title: '角色名称',
                align:"left",
                halign:"center"
            }, {
                field: 'description',
                title: '描述',
                align:"left",
                halign:"center"
            }],
        data: [
            {
                roleName:"APP用户",
                description:"APP登录用户，PC端不能登录"
            },{
                roleName:"系统管理员",
                description:"系统管理员"
            },{
                roleName:"APP用户",
                description:"APP登录用户，PC端不能登录"
            },{
                roleName:"系统管理员",
                description:"系统管理员"
            },{
                roleName:"APP用户",
                description:"APP登录用户，PC端不能登录"
            },{
                roleName:"系统管理员",
                description:"系统管理员"
            },{
                roleName:"APP用户",
                description:"APP登录用户，PC端不能登录"
            },{
                roleName:"系统管理员",
                description:"系统管理员"
            },{
                roleName:"APP用户",
                description:"APP登录用户，PC端不能登录"
            },{
                roleName:"系统管理员",
                description:"系统管理员"
            },{
                roleName:"APP用户",
                description:"APP登录用户，PC端不能登录"
            },{
                roleName:"系统管理员",
                description:"系统管理员"
            }
        ],
        pagination :true,
        paginationLoop: false,
        striped :true,
        paginationPreText : "上一页",
        paginationNextText :"下一页",
        undefinedText : "暂无数据",
        height:511,
        pageSize:15,
        search:true,
        searchAlign:"left",
        pageList :[10,15,20]
    });
}]);
app.controller("accountArea",["$scope",'$location',function($scope,$location){


}]);
